/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/17 15:13
  *
  * @file       pd_timer_ic.h
  * @brief      Header file of Timer IC hardware driver.
  *
  * @note       This file contains the Timer IC object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/17     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_TIMER_IC_H
#define JLC_SKY_TIMER_IC_H

#include "pd_timer.h"
#include "pd_timer_ch.h"
#include "drivers.h"

typedef struct TimerICDef TimerIC;

struct TimerICDef {
    Timer *timer;
    TimerCh *timerCH;

    uint32_t ICPolarity;
    uint32_t ICActiveInput;
    uint32_t ICPrescaler;
    uint32_t ICFilter;


    void (*init)(TimerIC *this, uint8_t isPWMI);

    uint32_t (*getFreq)(TimerIC *this);

    uint32_t (*getDuty)(TimerIC *this);
};

extern const struct TimerICClass {
    TimerIC *(*build)(Timer *timer, TimerCh *timerChannel);
} TimerICBuilder;

#endif //JLC_SKY_TIMER_IC_H
